<div class="container-fluid" xmlns="http://www.w3.org/1999/html">
  <!--leftTable-->
  <ul class="nav navbar-nav side-nav">
    <li>
      <button type="button" class="btn btn-info" data-toggle="modal" data-target="#addTaskModal"
              style="width: auto;height: auto">添加任务</button>
      <a id="deleteAll" role="button" class="btn btn-danger" data-toggle="modal" onclick="deleteAllTasks()"
              style="display: none">删除全部任务</a>
    </li>
    <li>
      <a data-toggle="collapse" onclick="showManagerTask()" style="display: none"> 任务管理 </a>
      <% if (data) { %>
      <% data.forEach(function(record,index){ %>
    <li>
      <a href="javascript:void(0)" data-toggle="collapse" data-target="<%='#info' + index%>">
        <i class="fa fa-fw"></i> <%=record.Task_name%>
        <i class="fa fa-fw fa-caret-up" style="display: none"></i>
        <div>
          <button id="<%='edit_task_'+index %>" name="getCurTask" uniqid="<%= record.uniqID %>" class="fa fa-edit"
                  style="width: auto;height: auto">编辑</button>
        </div>
      </a>
      <ul id="<%='info' + index%>" class="collapse" style="display: none">
        <% var cases = record.Cases; cases.forEach(function(caseItem,recordIndex){ %>
        <li>
          <a id="<%=caseItem.name%>" name="<%=caseItem.name%>" onclick="requestItem(this)"><%=caseItem.name%></a>
        </li>
        <% }) %>
      </ul>
    </li>
    <% }) %>
    <% } %>
    </li>
  </ul>
</div>

<div id="page-wrapper-right" aria-hidden="false" class="right-operation" >
  <!-- Page Heading -->
  <div class="row">
    <div class="col-lg-12">
      <h1 class="page-header" style="position: static"><%data&&data.length>0?data[0].Task_name:'无'%>
        <!--<small>顺序用例表</small>-->
      </h1>
      <ol class="breadcrumb">
        <li class="active">
          <i class="fa fa-tasks"></i>顺序用例
        </li>
      </ol>
    </div>
  </div>
  <!-- /.row -->
  <div class="row">
    <div class="col-lg-12">
      <div class="panel panel-default">
        <div class="panel-body">
          <div class="table-responsive">
            <table id="taskTable" class="table table-bordered table-hover table-striped">
              <thead>
                <tr>
                  <th>顺序用例名</th>
                  <th>描述</th>
                  <th>用例数量</th>
                  <th>操作</th>
                </tr>
              </thead>

              <tbody>
              <% if (data) { %>
              <% data.forEach(function(record,index){ %>
                <tr>
                  <td ><%-record.Task_name%></td>
                  <td><%-record.Task_desc%></td>
                  <td><%-record.Cases?record.Cases.length:0 %></td>
                  <td>
                    <a style="cursor: pointer" name="querySequence" uniqid="<%= record.uniqID %>">查看</a>
                    <a style="cursor: pointer" name="editAPI" uniqid="<%= record.uniqID %>">修改</a>
                    <a style="cursor: pointer" name="removeAPI" uniqid="<%= record.uniqID %>">删除</a>
                    <div style="display: none; float: right">
                      <button name="<%-record.uniqID%>" class="btn btn-xs btn-primary" onclick="runSelectedTask(this.name)">运行</button>
                      <button name="<%-record.uniqID%>" class="btn btn-xs btn-danger" onclick="deleteSelectedTask(this.name)">删除</button>
                    </div>
                  </td>
                </tr>
                <tr id="test_hidden_row" style="display: none">
                <td >hello,world!</td>
                <td >hello,world!</td>
                <td >hello,world!</td>
                <td >hello,world!</td>
              </tr>
              <% }) %>
              <% } %>
              </tbody>
            </table>
          </div>
          <div class="text-right">
            <a href="#">View All Transactions <i class="fa fa-arrow-circle-right"></i></a>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- /.row -->
</div>
<!-- /.container-fluid -->

<!--弹模态框, 添加任务(addTaskModal) -->
<div id="addTaskModal" class="modal fade in" tabindex="-1" aria-labelledby="addTaskModalLabel">
  <div class="modal-dialog">
    <div class="modal-content">
      <form id="form"  method="POST">
        <div class="modal-header"><button class="close" type="button" data-dismiss="modal">&times;</button>
          <h4 id="addTaskModalLabel" class="modal-title">添加任务</h4>
        </div>

        <div class="modal-body">
          <div class="form-group">
            <label style="font-size: 18px">顺序用例名</label>
            <input name="sequenceCase_name" type="text" class="form-control" placeholder="">
          </div>
          <div class="form-group">
            <label style="font-size: 18px">描述</label>
            <input name="sequenceCase_desc" type="text" class="form-control" placeholder="">
          </div>
        </div>
        <div class="modal-footer">
          <button class="btn btn-default" type="button" data-dismiss="modal">取消</button>
          <!--<button onclick="demoClicked()" class="btn btn-primary" type="button" data-dismiss="modal">添加</button>-->
          <button class="btn btn-primary" type="button" id="saveBtn">添加</button>
        </div>
      </form>

    </div>
  </div>
</div>


<script src="/xd-autotest-framework/js/index/frame-right.js"></script>
<script src="/xd-autotest-framework/js/task/task.js"></script>
